package boardgamer.common.net.testing;

import com.google.common.base.Objects;

import boardgamer.common.net.PlayerId;

public class TestPlayerId extends PlayerId {
  private static int nextId = 0;

  private final int id;

  private TestPlayerId() {
    this.id = nextId++;
  }

  public static PlayerId next() {
    return new TestPlayerId();
  }

  @Override
  public boolean equals(Object obj) {
    if (!(obj instanceof TestPlayerId)) {
      return false;
    }
    TestPlayerId that = (TestPlayerId) obj;
    return Objects.equal(this.id, that.id);
  }

  @Override
  public int hashCode() {
    return Objects.hashCode(id);
  }

  @Override
  public String getName() {
    return Integer.toString(id);
  }
}
